home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / gcc / ixemlsdk.lha / include / amitcp / socketbasetags.h next >
C/C++ Source or Header  |  1996-03-13  |  4KB  |  138 lines

  1. #ifndef AMITCP_SOCKETBASETAGS_H
  2. #define AMITCP_SOCKETBASETAGS_H \
  3.        "$Id: socketbasetags.h,v 4.2 1994/10/05 23:16:56 ppessi Exp $"
  4. /*
  5.  *      TAG values for SocketBaseTagList()
  6.  *
  7.  *      Copyright © 1994 AmiTCP/IP Group,
  8.  *                       Network Solutions Development, Inc.
  9.  *                       All rights reserved.
  10.  */
  11.  
  12. #ifndef UTILITY_TAGITEM_H
  13. #include <utility/tagitem.h>
  14. #endif
  15.  
  16. /*
  17.  * utility/tagitem.h specifies that bits 16-30 in tags are reserved. So we 
  18.  * don't use them for maximum compatability.
  19.  */
  20.  
  21. /*
  22.  * Argument passing convention (bit 15)
  23.  */
  24. #define SBTF_REF 0x8000        /* 0x0000 == VAL */
  25.  
  26. /*
  27.  * Code (bits 1-14)
  28.  */
  29. #define SBTB_CODE 1
  30. #define SBTS_CODE 0x3FFF
  31. #define SBTM_CODE(tag) (((UWORD)(tag) >> SBTB_CODE) & SBTS_CODE)
  32.  
  33. /* 
  34.  * Direction (bit 0)
  35.  */
  36. #define SBTF_SET  0x1        /* 0 == GET */
  37.  
  38. /*
  39.  * Macros to set things up
  40.  * We keep the TAG_USER (bit 31) set to be compatible with tagitem.h
  41.  * conventions.
  42.  */
  43. #define SBTM_GETREF(code) \
  44.   (TAG_USER | SBTF_REF | (((code) & SBTS_CODE) << SBTB_CODE))
  45. #define SBTM_GETVAL(code) \
  46.   (TAG_USER | (((code) & SBTS_CODE) << SBTB_CODE))
  47. #define SBTM_SETREF(code) \
  48.   (TAG_USER | SBTF_REF | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_SET)
  49. #define SBTM_SETVAL(code) \
  50.   (TAG_USER | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_SET)
  51.  
  52. /*
  53.  * Tag code definitions. These codes are used with one of the above macros.
  54.  *
  55.  * All arguments are ULONG's or pointers (PTR suffix).
  56.  *
  57.  * NOTE: Tag code 0 is not used (see utility/tagitem.h).
  58.  */
  59.  
  60. /* signal masks */
  61. #define SBTC_BREAKMASK        1
  62. #define SBTC_SIGIOMASK        2
  63. #define SBTC_SIGURGMASK        3
  64. #define SBTC_SIGEVENTMASK    4 /* V 4.0 addition */
  65.  
  66. /* error code handling */
  67. #define SBTC_ERRNO        6
  68. #define SBTC_HERRNO        7
  69.  
  70. /* socket descriptor table related tags */
  71. #define SBTC_DTABLESIZE         8
  72.  
  73. /* link library fd allocation callback
  74.  * 
  75.  * Argument is a callback function with following prototype
  76.  *
  77.  * int fd = fdCallback(int fd, int action);
  78.  *     D0                  D0      D1
  79.  *
  80.  * see net.lib sources for an example
  81.  */
  82. #define SBTC_FDCALLBACK         9
  83. /*
  84.  * "action" values:
  85.  */
  86. #define FDCB_FREE  0
  87. #define FDCB_ALLOC 1
  88. #define FDCB_CHECK 2
  89.  
  90. /* syslog variables (see netinclude:sys/syslog.h for values) */
  91. #define SBTC_LOGSTAT        10
  92. #define SBTC_LOGTAGPTR        11
  93. #define SBTC_LOGFACILITY    12
  94. #define SBTC_LOGMASK        13
  95.  
  96. /*
  97.  * The argument of following error string tags is a ULONG,
  98.  * where the error number is stored. On return the string pointer is 
  99.  * returned on this same ULONG. (GET ONLY)
  100.  *
  101.  * NOTE: error numbers defined in <exec/errors.h> are negative and must be
  102.  * negated (turned to positive) before passing to the SocketBaseTagList().
  103.  */
  104. #define SBTC_ERRNOSTRPTR    14 /* <sys/errno.h> */
  105. #define SBTC_HERRNOSTRPTR    15 /* <netdb.h> */
  106. #define SBTC_IOERRNOSTRPTR    16 /* <exec/errors.h> SEE NOTE ABOVE */
  107. #define SBTC_S2ERRNOSTRPTR    17 /* <devices/sana2.h> */
  108. #define SBTC_S2WERRNOSTRPTR    18 /* <devices/sana2.h> */
  109.  
  110.  
  111. /* errno pointer & size SETTING (only) */
  112. #define SBTC_ERRNOBYTEPTR    21
  113. #define SBTC_ERRNOWORDPTR    22
  114. #define SBTC_ERRNOLONGPTR    24
  115. /*
  116.  * Macro for generating the errnoptr tag code from a (constant) size.
  117.  * only 1,2 & 4 are legal 'size' values. If the 'size' value is illegal,
  118.  * the tag is set to 0, which causes SocketBaseTagList() to fail.
  119.  */
  120. #define SBTC_ERRNOPTR(size)    ((size == sizeof(long)) ? SBTC_ERRNOLONGPTR   :\
  121.                 ((size == sizeof(short)) ? SBTC_ERRNOWORDPTR :\
  122.                  ((size == sizeof(char)) ? SBTC_ERRNOBYTEPTR :\
  123.                   0)))
  124.  
  125. /* h_errno pointer */
  126. #define SBTC_HERRNOLONGPTR    25
  127.  
  128. #ifdef notyet
  129. /*
  130.  * Different boolean variables
  131.  */
  132. /* use 4.3BSD compatible sockaddr structures */
  133. #define SBTC_COMPAT43           29 
  134. #endif
  135.  
  136.  
  137. #endif /* !AMITCP_SOCKETBASETAGS_H */
  138.